import Vue from "vue";
import App from "./App.vue";
import wx from "weixin-jsapi";
import * as myApi from "@/api";
import apiConfig from "./apiConfig/index";
import axios from "./plugins/axios";
import router from "./router";
import store from "./store";
import base from '@/assets/js/base'
import wxFunction from '@/assets/js/wxFunction'
import Vant from 'vant'; 
import 'vant/lib/index.css';
import quillEditor from 'vue-quill-editor';
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

import * as echarts from "echarts";
//自定义全局搜索组件
// import SearchBar from "./components/global/SearchBar";
// Vue.component("search-bar", SearchBar);

//element ui
// import ElementUI from "element-ui"; 
// import "element-ui/lib/theme-chalk/index.css";
// Vue.use(ElementUI);

router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  console.log(to)
  if (to.name) {
    document.title = to.name
  }
  next()
})
Vue.use(quillEditor)
Vue.config.productionTip = false;
Vue.prototype.$echarts = echarts 

// Vue.use(rem);//全局引入rem js
Vue.use(wx);
Vue.use(base);
Vue.use(wxFunction);
Vue.use(Vant);
Vue.prototype.$myApi=myApi
Vue.config.ignoredElements=['wx-open-launch-weapp']
//时间转换
//案例 new Date().Format("yyyy-MM-dd hh:mm:ss")
Date.prototype.Format = function (fmt) {
  // author: meizz
  var o = {
    'M+': this.getMonth() + 1, // 月份
    'd+': this.getDate(), // 日
    'h+': this.getHours(), // 小时
    'm+': this.getMinutes(), // 分
    's+': this.getSeconds(), // 秒
    'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
    S: this.getMilliseconds(), // 毫秒
  };
  if (/(y+)/.test(fmt))
    fmt = fmt.replace(
      RegExp.$1,
      (this.getFullYear() + '').substr(4 - RegExp.$1.length)
    );
  for (var k in o)
    if (new RegExp('(' + k + ')').test(fmt))
      fmt = fmt.replace(
        RegExp.$1,
        RegExp.$1.length == 1 ?
        o[k] :
        ('00' + o[k]).substr(('' + o[k]).length)
      );
  return fmt;
};

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
